The approaches described in this section are approaches that could be pursued, but not necessarily approaches that have been previously conceived or pursued. Therefore, unless otherwise indicated, it should not be assumed that any of the approaches described in this section qualify as prior art merely by virtue of their inclusion in this section.
In a computer system, trace logging is a form of computer logging useful for recording information about a software program's execution. The information recorded in a trace log is used by computer software programmers, computer system administrators, and other technical personnel to troubleshoot problems that occur during execution of software programs.
To enable trace logging by a software program, the source code of the program can be instrumented with trace logging calls to a trace logging module. When the code or a compiled version thereof is executed by a computer system, the trace logging calls cause trace logging messages to be written to a trace log where they can be analyzed by troubleshooting personnel. A trace logging message written to a trace log may indicate, for example, a state of the software program's execution at the time of the call or other useful information for troubleshooting the program's execution.
A trace logging call can specify a trace logging severity and a trace logging message as parameters to the call. Typically, the trace logging severity parameter indicates one severity in a range of tracing severity to associate with the message. An example range of tracing severity from most severe to least severe is: “Error”, “Warning”, “Notice”, “Info”, “Debug”, and “Trace”.
To filter the trace logging messages that are stored in a trace log, a trace logging module may be configured to operate according to an administrator-specified trace logging level. The administrator-specified trace logging level affects what trace logging messages passed as parameters to trace logging calls are stored in a trace log during execution of the software program. In response to receiving a trace logging call, to determine whether a trace logging message passed in the call should be added to a trace log, the trace logging module may compare the trace logging severity passed in the call with the administrator-specified trace logging level. Trace logging messages associated with a trace logging severity that is less severe that the trace logging level will not be stored in a trace log and trace logging messages associated with a trace logging severity equal to or greater than the trace logging level will be stored in a trace log.
However, administrator-specified trace logging levels offer the administrator with a limited choice. On the one hand, the administrator can configure the trace logging module with a trace logging level of relatively low severity such as, for example, “Info”. This will cause the trace logging module to add a relatively large number of trace logging messages to a trace log than would otherwise be added if the trace logging level is set to a higher severity such as, for example, “Warning”. A relatively low severity trace logging level may be used by the administrator to ensure that important trace logging messages are not missed if and when a problem occurs with the executing software program. However, setting a trace logging level to a relatively low severity in this way has several drawbacks. For one, excessive trace logging messages are added to trace log even when there is no problem occurring in the executing software program. When a problem does occur, the administrator must sift through the extraneous trace log messages in the trace log to find messages that are relevant to the problem at hand. For another, storing trace log messages in a trace log consumes computing resources such as disk space and CPU that are also needed by other operations of the executing software program. Thus, setting a trace logging level in this way may cause significant degradation in the computing performance of the executing software program noticeable to end-users.
On the other hand, the administrator can set the trace logging level to a relatively high severity such as, for example, Warning. Setting the trace logging level in this way may prevent significant degradation in computing performance, but at the expense of potentially missing important trace logging messages useful for debugging or diagnosing problems with execution of a software program.
What is needed, therefore, is trace logging techniques that do not cause significant performance degradation to executing software processes that compete with trace logging operations for scarce computing resources while at the same time capturing sufficient trace logging messages useful for troubleshooting problems with software program execution. In a more general sense, there is a need for techniques for adaptive trace logging.